function ListNode(val){
    this.val = val
    this.next = null
}
/**
 * @param {ListNode} head
 * @return {boolean}
 */
var isPalindrome = function(head) {
    if (head.next == null) return true
    let arr = []
    let p = head
    let n= 0
    while (p != null) {
        arr.push(p.val)
        p = p.next
        n++
    }
    for (let i = 0,j = n-1; i < j; i++, j-- ){
        if (arr[i] != arr[j]) {
            return false
        }
    }
    return true
};
var isPalindrome = function(head) {
    let p = head
    let map = new Map()

}
let head = new ListNode(1)
head.next = new ListNode(1)
head.next.next = new ListNode(2)
head.next.next.next = new ListNode(1)
console.log(isPalindrome(head))